<template>

  <data-table
    ref="pagingTable"
    :options="options"
    :list-query="listQuery"
  >
    <template slot="filter-content">
      <el-input v-model="listQuery.params.title" placeholder="搜索考试名称" style="width: 200px;" class="filter-item" />
    </template>

    <template slot="data-columns">

      <el-table-column
        label="考生姓名"
        prop="realName"
      />

      <el-table-column
        label="考试时间"
        align="center"
        prop="createTime"
        :formatter="formatter2"
      />

      <el-table-column
        label="考试时长（分钟）"
        width="220px"
        align="center"
        prop="userTime"
      />

      <el-table-column
        label="主观分"
        prop="subjScore"
        align="center"
      />

      <el-table-column
        label="客观分"
        prop="objScore"
        align="center"
      />

      <el-table-column
        label="总分"
        prop="userScore"
        align="center"
      />

      <el-table-column
        label="考试状态"
        align="center"
      >
        <template slot-scope="scope">
          {{ scope.row.state | paperStateFilter }}
        </template>
      </el-table-column>

      <el-table-column
        label="操作"
        align="center"
        width="220px"
      >
        <template slot-scope="scope">
          <el-button v-if="scope.row.state==1" type="primary" size="mini" icon="el-icon-finished" @click="handleExamDetail(scope.row.id)">批阅</el-button>
          <el-button type="warning" size="mini" icon="el-icon-view" @click="handleExamInfo(scope.row.id)">详情</el-button>
        </template>
      </el-table-column>

    </template>

  </data-table>

</template>

<script>
import DataTable from '@/components/DataTable'
import { dateTimeFormatter } from '@/utils/date'
export default {
  name: 'EeviseUserList',
  components: { DataTable },
  data() {
    return {
      listQuery: {
        current: 1,
        size: 10,
        params: {
          title: ''
        }
      },

      options: {
        // 可批量操作
        multi: false,
        // 列表请求URL
        listUrl: '/exam/api/paper/paper/paging-admin'
      }
    }
  },
  methods: {

    handleExamInfo(examId) {
      this.$router.push({ name: 'ShowExam', params: { id: examId }})
    },
    handleExamDetail(examId) {
      this.$router.push({ name: 'reviseResult', params: { id: examId }})
    },
    formatter2(obj) {
      return dateTimeFormatter(obj.createTime)
    }
  }
}
</script>
